Skip to content

feat: 서버 집계 함수에 goalIds 필터 추가#3

Merged
ramong26 merged 1 commit into
developfrom
feature/dashboard-detail-api
Apr 20, 2026
Merged

feat: 서버 집계 함수에 goalIds 필터 추가#3
ramong26 merged 1 commit into
developfrom
feature/dashboard-detail-api

Conversation

@ramong26

Copy link
Copy Markdown
Owner

무엇을 변경했나요?

(변경 내용 1~2줄 요약)

왜 이렇게 했나요?

(선택한 이유, 다른 방법 대신 이걸 선택한 이유)

리뷰어가 특히 봐줬으면 하는 부분

  • (예: 이 로직이 엣지케이스를 잘 처리하는지)

스크린샷 (UI 변경 시)

@vercel

vercel Bot commented Apr 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bearlog Building Building Preview, Comment Apr 20, 2026 5:54am

@ramong26 ramong26 merged commit 97ec23b into develop Apr 20, 2026
1 of 5 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ability to filter dashboard todos by specific goal IDs and fixes character encoding issues in toast messages. Key changes include updating the API route to parse goal IDs, modifying the dashboard component to fetch todos based on visible goals, and refining the data fetching logic. Feedback highlights potential data omission issues due to hardcoded limits: the goal fetch limit (50) may conflict with the client-side limit (100), and the reduced todoFetchLimit for tasks could lead to missing items if they fall outside the fetched range. Additionally, the hardcoded limit of 100 for the goals list should be reviewed for scalability.

fetchGoals.getGoals(),
fetchTodos.getTodos({ sort: 'LATEST', search: '', limit: 300, done: false }),
fetchTodos.getTodos({ sort: 'LATEST', search: '', limit: 300, done: true }),
fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 50) }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

fetchGoals.getGoalslimitMath.max(targetGoalIds.length, 50)으로 설정되어 있어 버그가 발생할 가능성이 있습니다. 클라이언트(DashboardDetail)에서는 최대 100개의 목표 ID를 보낼 수 있는데, 만약 요청된 ID가 서버의 전체 목표 목록 중 상위 50개 이후에 위치한다면 해당 목표 정보를 가져오지 못하게 됩니다. 클라이언트에서 보낼 수 있는 최대 범위(현재 100개)를 고려하여 limit을 설정해야 합니다.

Suggested change
fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 50) }),
fetchGoals.getGoals({ limit: Math.max(targetGoalIds.length, 100) }),

export default function DashboardDetail() {
const mode = useTodoModeStore((state) => state.mode);
const { data: goalDetail } = useQuery(dashboardQueries.detailTodos());
const { data: goals, isFetched: isGoalsFetched } = useQuery(goalQueries.list({ limit: 100 }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

goalQueries.list 호출 시 limit: 100으로 하드코딩되어 있습니다. 사용자의 목표(Goal) 개수가 100개를 초과할 경우 일부 목표가 대시보드에 표시되지 않을 수 있습니다. 시스템의 최대 목표 생성 제한이 없다면, 페이지네이션을 도입하거나 충분히 큰 값을 사용하도록 검토가 필요합니다.

export const getDashboardDetailTodos = async (goalIds?: number[]): Promise<DashboardDetailTodosResult> => {
const targetGoalIds = normalizeGoalIds(goalIds);
const targetGoalIdSet = new Set(targetGoalIds);
const todoFetchLimit = Math.max(SAFE_LIMIT * Math.max(targetGoalIds.length, 1), SAFE_LIMIT * 5);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

todoFetchLimit 계산 로직이 변경되면서 기존(300개)보다 조회하는 할 일(Todo)의 수가 크게 줄어들 수 있습니다. (예: 목표가 지정되지 않았거나 1개일 때 50개만 조회). 이 함수는 전체 할 일 목록을 최신순으로 가져온 뒤 메모리에서 필터링하므로, 특정 목표의 할 일이 전체 최신 목록의 상위 todoFetchLimit 범위를 벗어나면 대시보드에서 해당 데이터가 누락되어 보일 수 있습니다. 데이터 정합성을 위해 limit을 상향하거나 목표별 조회가 가능한지 확인이 필요합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant